	<div class="product-detail">
	<?php

		if(!empty($this->Item)):
			$config = new Zendvn_Controller_Config (array(
														'module' => 'admin',
														'fileConfig' => 'product-category.ini' 
												));
			$itemConfig = $config->getconfig('item');
			
			$imgUrlThumb = $itemConfig['thumbUrl1'];
			$imgPathThumb = $itemConfig['uploadDir'];
			$imgUrl 	= $itemConfig['uploadUrl'];
			$i = 0;
			$filter 	= new Zendvn_Filter_Filter();
			
			$id 		= $this->Item['id'];
			$name 		= Zendvn_Filter_Filter::filterContent($this->Item['name'], 'filter');
			$cat_name	= Zendvn_Filter_Filter::filterContent($this->Item['cat_name'], 'filter');
			$content	= Zendvn_Filter_Filter::filterContent($this->Item['content']);
			
			$pictures = $this->Item['images'];
			if(!empty($pictures))
				$arrPicture = json_decode($this->Item['images'], true);
			
			$picture 	= $this->Item['image'];
			$no_price	= $this->Item['no_price'];
			if(file_exists($itemConfig['uploadDir'] . '/' . $picture) && !empty($picture)){
				$picture = $itemConfig ['uploadDir'] . '/' . $picture;
				$picture = $this->cmsUrl(array(
						                    'module' => 'default',
						                    'controller' => 'scripts',
						                    'action' => 'create-image',
						                    'name' => base64_encode($picture),
						                    'width' => 260,
						                    'heigh' => 320,
						                    'type' => 'landscape'
						                    ));
				$orginalPicture = $itemConfig['uploadUrl'] . '/' . $this->Item['image'];
			} else {
				$orginalPicture = $picture = FILE_URL . '/no-image.png';
			}
			
			$price 		= $this->Item['price'];
			$sell_off 	= $this->Item['sale_price'];
			$newPrice 	= (empty($sell_off) || $sell_off == 0)?$price:$sell_off;
			$newPrice	= ($no_price == 1)?'Call':number_format($newPrice) . ' VNĐ';
			
			$on_sale 	= (empty($sell_off) || $sell_off == 0)?'':'<div class="onsale">on sale!</div>';
		endif;
	?>
		<div class="information">
			<div class="main-image">
				<img src="<?php echo $picture?>" alt="beboshop" title="<?php echo $name?>" />
	        </div>   	
			<div class="product-info">
				<h2><?php echo $name?></h2>
				<ul>
					<li><span class="label">Danh mục</span>: <span><?php echo $cat_name?></span></li>
					<li><span class="label">Nhà sản xuất</span>: <span>Hàng Việt Nam Xuất Khẩu</span></li>
					<li><span class="label">Màu sắc</span>: <span>Như hình</span></li>

					<li><span class="label">Giá</span>: <span class="pro-price"><?php echo $newPrice?></span></li>
					<?php if(!empty($sell_off) && $sell_off != 0 && $no_price == 0):?>
					<li><span class="label">Giá gốc</span>: <span class="pro-price sale"><?php echo number_format($price) . ' VNĐ'?></span></li>
					<?php endif;?>
					<li><span class="label">Số lượng</span>: <span><input type="text"
							class="quantity-input" name="quantity[]" value="1"></span></li>
					<li><span class="label">Trạng thái</span>: <span>Còn hàng</span></li>		
				</ul>
			</div>
		</div>
		<div class="product-description">
			<div class="desc-head">
				<ul>
					<li class="active" id="act-pro-desc">Thông tin sản phẩm</li>
					<li id="act-facebook-comment">Bình luận</li>
				</ul>
			</div>
			<div class="desc-content">
			    <div id="pro-desc"><?php echo $content?></div>
			    <div id="facebook-comment" style="display: none;">
			        <div id="fb-root"></div>
                    <script>(function(d, s, id) {
                      var js, fjs = d.getElementsByTagName(s)[0];
                      if (d.getElementById(id)) return;
                      js = d.createElement(s); js.id = id;
                      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
                      fjs.parentNode.insertBefore(js, fjs);
                    }(document, 'script', 'facebook-jssdk'));</script>
                    <div class="fb-comments" 
                            data-href="<?php echo HTTP . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];?>" 
                            data-width="960"></div>
			    </div>
			</div>
		</div>
		<div class="related_product" id="related-product" style="text-align: center;">
			<img src="<?php echo FILE_URL . '/images/ajax-loader.gif'?>" />
		</div>
	</div>

<?php 
    $linkLoadRelatedProduct = $this->cmsUrl(array(
                                                'module' => 'default',
                                                'controller' => 'index',
                                                'action' => 'related-product',
                                                'product-id' => $this->Item['id']
                                                ));  
?>


<script>
	$(document).ready(function(){
		anchorAnimate('.featured-view');
		$('#slide_img').prettyGallery({
			'navigation': 'bottom',
			'itemsPerPage': 4,
			'next_label': '',
			'previous_label': ''
		});

		$("a[rel=group_thumb]").fancybox({
			'titleShow' 	: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'centerOnScroll': true,
			'scrolling'		: scroll,
		});
		
		$('.desc-head li').click(function(){
			if($(this).hasClass('active')){
			    return false;
			}
			$('.desc-head li').removeClass('active');
			$(this).addClass('active');
			var id = $(this).attr('id');
			$('div.desc-content > div').hide();
			if(id == 'act-pro-desc'){
				$('div#pro-desc').fadeIn();
			}else if(id == 'act-facebook-comment'){
				$('div#facebook-comment').fadeIn();
			}else if(id == 'act-related-product'){
				$('div#related-product').fadeIn();
				
			}
		})

		$.post('<?php echo $linkLoadRelatedProduct?>', {tags:'<?php echo $this->Item['tags']?>', cat_id:'<?php echo $this->Item['cat_id']?>'}, function(data){
			$('div#related-product').html(data).attr('style', '');
		})
	})
</script>